home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
var
/
lib
/
dpkg
/
info
/
wvdial.postinst
< prev
next >
Wrap
Text File
|
2008-05-19
|
2KB
|
79 lines
#!/bin/sh
set -e
if [ "$1" = "configure" ]; then
set +e
# Source Debconf module
. /usr/share/debconf/confmodule
# Update the /etc/wvdial.conf file
db_get wvdial/wvdialconf
if [ "$RET" = "true" ]; then
db_get wvdial/phone
phone="$RET"
db_get wvdial/login
login="$RET"
db_get wvdial/passphrase
password="$RET"
db_reset wvdial/passphrase
db_reset wvdial/passphrase2
if [ ! -e '/etc/wvdial.conf' ]; then
# Create /etc/wvdial.conf
umask 077
cat >/etc/wvdial.conf <<-EOF
[Dialer Defaults]
Phone = $phone
Username = $login
Password = $password
New PPPD = yes
EOF
chown root:dialout /etc/wvdial.conf
chmod 0640 /etc/wvdial.conf
elif type uni >/dev/null 2>/dev/null; then
export UNICONF='ini:/etc/wvdial.conf'
if [ -n "$phone" ]; then
uni set '/Dialer Defaults/Phone' "$phone"
uni del '/Dialer Defaults/; Phone'
fi
if [ -n "$login" ]; then
uni set '/Dialer Defaults/Username' "$login"
uni del '/Dialer Defaults/; Username'
fi
if [ -n "$password" ]; then
uni set '/Dialer Defaults/Password' "$password"
uni del '/Dialer Defaults/; Password'
fi
fi
if grep -qi ^modem /etc/wvdial.conf 2>/dev/null; then
echo
echo "/etc/wvdial.conf already exists -- not probing your modem."
echo " (Run wvdialconf manually if you want to re-detect your modem.)"
echo
else
# Try to detect the modem
if wvdialconf /etc/wvdial.conf >/var/log/wvdialconf.log 2>&1; then
if [ -e /etc/wvdial.conf ]; then
chown root:dialout /etc/wvdial.conf
chmod 0640 /etc/wvdial.conf
fi
echo
echo "Success! You can run \"wvdial\" to connect to the internet."
echo " (You can also change your configuration by editing /etc/wvdial.conf)"
echo
else
echo
echo "Sorry. You can retry the autodetection at any time by running \"wvdialconf\"."
echo " (Or you can create /etc/wvdial.conf yourself.)"
fi
chmod 0644 /var/log/wvdialconf.log
fi
fi
fi